<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	
<div id="main" style="padding:20px 50px;">
<div class="page">
				<ul>
				<li>共查询出&nbsp;<s:property value="pageCtrl.resultCount"/>条&nbsp;</li>
				<li>每页<span style="color:red" ><s:property value="pageCtrl.pageSize"/></span>条</li>&nbsp;&nbsp;
				<li>页次：第<span style="color:red" ><s:property value="pageCtrl.pageNo+1"/></span>页&nbsp;&nbsp;</li>
				<li>共<span style="color:red"><s:property value="pageCtrl.pageCount"/></span>页&nbsp;</li>
			          
			          <s:if test="pageCtrl.pageNo==0">
			          	<li>
			          首页&nbsp;&nbsp;
			          <li>上页&nbsp;&nbsp;</li>
			          </s:if>
			          <s:else>
			          
			                <li><a href="<%=path%>/yc/message/message!messageindex.do"><span style="color:red">首页</span></a>&nbsp;&nbsp;</li>
			                <li><a href="<%=path%>/yc/message/message!messageindex.do?pageNo=<s:property value="pageCtrl.pageNo-1"/>"><span style="color:red">上页</span></a>&nbsp;&nbsp;</li>
			          </s:else>
			          <s:if test="pageCtrl.pageCount==0||pageCtrl.pageNo+1==pageCtrl.pageCount">
			         	<li> 下页&nbsp;&nbsp;</li>
			         	<li>末页&nbsp;&nbsp;</li>
			          </s:if>
			          <s:else>
			         <li> <a href="<%=path%>/yc/message/message!messageindex.do?pageNo=<s:property value="pageCtrl.pageNo+1"/>"><span style="color:red">下页</span></a>&nbsp;&nbsp;</li>
			         <li> <a href="<%=path%>/yc/message/message!messageindex.do?pageNo=<s:property value="pageCtrl.pageCount-1"/>"><span style="color:red">末页</span></a>&nbsp;&nbsp;</li>
			          </s:else>
				
				</ul>
			</div>
<div class="clear"></div>
<div class="msgList">
	<div class="hd">留言记录</div>
	<div class="bd">
		<ul class="msgLcon">
		<s:iterator var="message" value="commentcontent1" status="st">	
			
			<li>
				<div class="speak">
					<div class="speakhd">
					<span class="author">发&nbsp;表&nbsp;人:&nbsp;<s:property value="#message.clientid"/></span>
					<span class="title">标&nbsp;&nbsp;题:&nbsp;<s:property value="#message.name"/></span>
					<em class="date">发表时间:<s:property value="#message.commenttime"/> </em>
					</div>
					<div class="msgcon"><s:property value="#message.commenttext"/></div>
				</div>
				<s:iterator var="messageReply" value="commentReply" status="st">
				<s:if test="#message.cid==#messageReply.cid">
				<div class="reply">
					<div class="speakhd">
					<span class="author">回&nbsp;复&nbsp;:&nbsp;<s:property value="#messageReply.clientid"/></span>
					<em class="date">回复时间:<s:property value="#messageReply.commenttime"/> </em>
					</div>
					<div class="msgcon"><s:property value="#messageReply.commenttext"/></div>
				</div>
				</s:if>
				</s:iterator>
			</li>
		</s:iterator>
		</ul>
	</div>	
</div>
<div class="page">
				<ul>
				<li>共查询出&nbsp;<s:property value="pageCtrl.resultCount"/>条&nbsp;</li>
				<li>每页<span style="color:red" ><s:property value="pageCtrl.pageSize"/></span>条</li>&nbsp;&nbsp;
				<li>页次：第<span style="color:red" ><s:property value="pageCtrl.pageNo+1"/></span>页&nbsp;&nbsp;</li>
				<li>共<span style="color:red"><s:property value="pageCtrl.pageCount"/></span>页&nbsp;</li>
			          
			          <s:if test="pageCtrl.pageNo==0">
			          	<li>
			          首页&nbsp;&nbsp;
			          <li>上页&nbsp;&nbsp;</li>
			          </s:if>
			          <s:else>
			          
			                <li><a href="<%=path%>/yc/message/message!messageindex.do"><span style="color:red">首页</span></a>&nbsp;&nbsp;</li>
			                <li><a href="<%=path%>/yc/message/message!messageindex.do?pageNo=<s:property value="pageCtrl.pageNo-1"/>"><span style="color:red">上页</span></a>&nbsp;&nbsp;</li>
			          </s:else>
			          <s:if test="pageCtrl.pageCount==0||pageCtrl.pageNo+1==pageCtrl.pageCount">
			         	<li> 下页&nbsp;&nbsp;</li>
			         	<li>末页&nbsp;&nbsp;</li>
			          </s:if>
			          <s:else>
			         <li> <a href="<%=path%>/yc/message/message!messageindex.do?pageNo=<s:property value="pageCtrl.pageNo+1"/>"><span style="color:red">下页</span></a>&nbsp;&nbsp;</li>
			         <li> <a href="<%=path%>/yc/message/message!messageindex.do?pageNo=<s:property value="pageCtrl.pageCount-1"/>"><span style="color:red">末页</span></a>&nbsp;&nbsp;</li>
			          </s:else>
				
				</ul>
			</div>
<div class="clear"></div>
<div class="speakcon">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr> 	 
	  <td height="34" align="center" class="acc_star">温馨提醒：带星号<span style="color: red;">(*)</span>的项目均为必填</td>
	</tr>
</table>
<form action="<%=path%>/yc/message/message!addmessage.do" method="post" onsubmit="return validate_form(this)">
<table class="msgTable" align="left" >
<tr>
	<td class="tit">姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名：<span style="color: red;">(*)</span></td>
	<td><input id="clientid" name="clientid" type="text" class="msgtxt" onblur="ValidateFactoryEmpty(this)"/></td>
	<td><div id="clientid_error" style="display: none;color: red;"><img height="20" src="<%=path %>/ycimages/error.png" />姓名不能为空</div></td>
</tr>
<tr>
	<td class="tit">标&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;题：<span style="color: red;">(*)</span></td>
	<td><input  id="name" name="name"  type="text" class="msgtxt" onblur="ValidateFactoryEmpty(this)"/></td>
	<td><div id="name_error" style="display: none;color:red;"><img height="20" src="<%=path %>/ycimages/error.png" />标题不能为空</div></td>
</tr>
<tr>
	<td class="tit">电&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;话：</td>
	<td><input id="auditer" name="auditer" type="text" class="msgtxt" onblur="ValidateFactoryTelephone(this)" /></td>
	<td><div id="auditer_error" style="display: none;color: red;" ><img height="20" src="<%=path %>/ycimages/error.png" />电话格式不正确</div></td>
</tr>
<tr>
	<td class="tit">邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;箱：</td>
	<td><input  id="deleter"  name="deleter"  type="text" class="msgtxt" onblur="ValidateFactoryEmail(this)" /></td>
	<td><div id="deleter_error" style="display: none;color: red;"><img height="20" src="<%=path %>/ycimages/error.png" />邮箱格式不正确</div></td>
</tr>
<tr>
	<td valign="top" class="tit">留言内容：<span style="color: red;">(*)</span></td>
	<td> <textarea id="commenttext"  name="commenttext" class="msgarea" onblur="ValidateFactoryEmpty(this)"></textarea></td>
	<td><div id="commenttext_error" style="display: none;color: red; margin-top: -100px;"><img height="20" src="<%=path %>/ycimages/error.png" />留言内容不能为空</div></td>
	</tr>
	<tr>
		<td colspan="2" align="right"><input type="submit" class="msgbtn" value="提交" /></td>
	</tr>
</table>
</form>
</div>	
</div>
<script type="text/javascript">

function validate_required(field,alerttxt){
with (field){
  if (value==null||value==""){
      alert(alerttxt);
      return false
   }else {
      return true
}}}
function validate_email(field,alerttxt){
    with (field){
        var re = /^[a-zA-Z0-9]([a-zA-Z0-9]*[-_.]?[a-zA-Z0-9]+)+@([a-zA-Z0-9]+\.)+[a-zA-Z]{2,}$/;
        if(value==null||value==""){
            return true;
         }else if (re.test(value.trim())) {
            return true;
        }else {
            alert(alerttxt);
            return false;
        }
    }
}

function validate_telephone(field,alerttxt){
    with (field){
        if (value==null||value==""){
            return true;
         }else if (value.trim().length==11) {
             if(/^\d+$/.test(value.trim())){
                 return true;
             }else{
                 alert(alerttxt);
                 return false;   
             }
         }else{
            alert(alerttxt);
            return false;
}}}
function validate_form(thisform){
with (thisform){
    if (validate_required(clientid,"姓名不能为空!")==false){
        clientid.focus();
        return false;
    }else if(validate_required(name,"标题不能为空!")==false){
        name.focus();
        return false;
   }else if(validate_required(commenttext,"留言内容不能为空!")==false){
       commenttext.focus();
       return false; 
   }else if(validate_telephone(auditer,"电话格式不正确!")==false){
       auditer.focus();
       return false;
   }else if(validate_email(deleter,"E-mail格式不正确!")==false){
       deleter.focus();
       return false;
   }
      return true;
}
}
</script>
<script type="text/javascript">
function ValidateFactoryEmpty(thisTr) {
    var errorSpanId = thisTr.id+"_error";
    var value = $('#'+thisTr.id).val();
    var errorSpan = $("#"+errorSpanId);
    if (value==null||value==""){
        errorSpan.show();
    }else{
        errorSpan.hide();
    }
    
} 
function ValidateFactoryEmail(thisTr) {
    
    var errorSpanId = thisTr.id+"_error";
    var value = $('#'+thisTr.id).val();
    var errorSpan = $("#"+errorSpanId);
    var re = /^[a-zA-Z0-9]([a-zA-Z0-9]*[-_.]?[a-zA-Z0-9]+)+@([a-zA-Z0-9]+\.)+[a-zA-Z]{2,}$/;
    if(value==null||value==""){
        errorSpan.hide();
     }else if (re.test(value.trim())) {
         errorSpan.hide();
    }else {
        errorSpan.show();
    }
    
} 
function ValidateFactoryTelephone(thisTr) {
    
    var errorSpanId = thisTr.id+"_error";
    var value = $('#'+thisTr.id).val();
    var errorSpan = $("#"+errorSpanId);
    
    if (value==null||value==""){
        errorSpan.hide();
     }else if (value.trim().length==11) {
         if(/^\d+$/.test(value.trim())){
             errorSpan.hide();
         }else{
             errorSpan.show();
         }
     }else{
         errorSpan.show();
     }
    
}
</script>		

